/*
 * Regola Grammaticale:
 * <fact> → Num
 * 
 * Simboli terminali:
 * NUM → ("0" | ... | "9") [("0" | ... | "9")]*
 */
package composite.number_expression.fact;

import composite.Component;
import composite.number_expression.Fact;
import visitor.Visitor;

/**
 *
 * @author Antonio
 */
public class FactNum extends Fact {

    private String val;
    private int num;

    public FactNum(String val) {

        this.val = val;
    }

    public int getStato() {

        return num;
    }// getStato

    @Override
    public void interpreta(String contesto) {

        num = Integer.parseInt(val);
    }

    @Override
    public void accept(Visitor v) {

        v.visit(this);
    }

    @Override
    public String toString() {

        StringBuilder sb = new StringBuilder();

        return sb.append(num).toString();
    }

    @Override
    public void add(Component c) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
